import { SerializeStream } from "../../Framework/Serialize/SerializeStream";
//class DictIntDateHelper

export class DictIntDateHelper {
  public static write(
    arg1: SerializeStream,
    arg2: Record<number, Date> /* flash.utils.Dictionary */
  ): void {
    var loc1 = 0;
    var loc2 = null;
    var loc3 = null;
    if (arg2 != null) {
      loc1 = 0;
      var loc4 = 0;
      var loc5 = arg2;
      for (loc2 in loc5) {
        ++loc1;
      }
      arg1.writeSize(loc1);
      loc4 = 0;
      loc5 = arg2;
      for (loc3 in loc5) {
        arg1.writeInt(Number(loc3));
        arg1.writeDate(arg2[loc3] as Date);
      }
    } else {
      arg1.writeSize(0);
    }
    return;
  }

  public static read(arg1: SerializeStream /* flash.utils.Dictionary */) {
    var loc4 = 0;
    var loc5 = null;
    var loc1: Record<number, Date> = {};
    var loc2 = arg1.readSize();
    var loc3 = 0;
    while (loc3 < loc2) {
      loc4 = arg1.readInt();
      loc5 = arg1.readDate();
      loc1[loc4] = loc5;
      ++loc3;
    }
    return loc1;
  }
}
